package cn.edu.hqu.cst.android.ljc.test2;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Gravity;
import android.widget.Button;
import android.widget.LinearLayout;

public class uc1 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_uc1);

         LinearLayout layout = findViewById(R.id.layout);

         //水平布局
        Button uc1_bt1 = findViewById(R.id.uc1_bt1);
        uc1_bt1.setOnClickListener(view -> {
            layout.setOrientation(LinearLayout.HORIZONTAL);
            layout.setGravity(Gravity.CENTER);
        });

        //垂直布局
        Button uc1_bt2 = findViewById(R.id.uc1_bt2);
        uc1_bt2.setOnClickListener(view -> {
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setGravity(Gravity.CENTER);
        });


        //靠左布局
        Button uc1_bt3 = findViewById(R.id.uc1_bt3);
        uc1_bt3.setOnClickListener(view -> {
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setGravity(Gravity.LEFT);
        });

        //返回
        Button uc1_bt4 = findViewById(R.id.uc1_bt4);
        uc1_bt4 .setOnClickListener(view -> finish());
    }

}